#! nmake
#
# Makefile to build and execute VRDemo. Currently only works with nmake
#

LOCALCLASSPATH=lib\VRML97.jar;lib\commapi\comm.jar;bin

BUILD_DIR=bin

JJFLAGS=-classpath $(LOCALCLASSPATH) -d $(BUILD_DIR)

JJ=javac

OBJECTS=bin\BoxGeometry.class bin\ButtonDevice.class bin\FixedCanvas3D.class bin\VRMLObject.class bin\Hand.class bin\HeadBehavior.class bin\HandBehaviorGeneric.class \
bin\HandBehaviorPrimary.class bin\HandBehaviorSecondary.class bin\VR.class bin\FPSBehavior.class bin\OverlayGroup.class bin\WorldMain.class


all: tracker world $(OBJECTS)
	
.SUFFIXES: .class .java


# build rules for the main project files
#
{src}.java{$(BUILD_DIR)}.class:
	$(JJ) $(JJFLAGS) $<

bin\ButtonDevice.class: $(BUILD_DIR)\VR.class $(BUILD_DIR)\ButtonDeviceSerialPort.class
bin\OverlayGroup.class: $(BUILD_DIR)\FixedCanvas3D.class	
bin\FPSBehavior.class: $(BUILD_DIR)\tracker\TrackerThread.class $(BUILD_DIR)\OverlayGroup.class


# build the tracker package
#
{src\tracker}.java{$(BUILD_DIR)\tracker}.class:
	$(JJ) $(JJFLAGS) $<

tracker: $(BUILD_DIR)\tracker\TrackerPolhemus.class $(BUILD_DIR)\tracker\TrackerSerialPort.class $(BUILD_DIR)\tracker\TrackerFastrak.class \
         $(BUILD_DIR)\tracker\TrackerIsotrakII.class $(BUILD_DIR)\tracker\TrackerThread.class
$(BUILD_DIR)\tracker\TrackerSerialPort.class: $(BUILD_DIR)\tracker\TrackerFastrak.class $(BUILD_DIR)\tracker\TrackerIsotrakII.class


# build the default workld package
#
world: $(BUILD_DIR)\world\ClockBehavior.class $(BUILD_DIR)\world\geometry\Clock.class $(BUILD_DIR)\world\geometry\Room.class \
	   $(BUILD_DIR)\world\geometry\Walls.class $(BUILD_DIR)\world\geometry\FloorCeiling.class $(BUILD_DIR)\world\geometry\Goblet.class

{src\world}.java{$(BUILD_DIR)\world}.class:
	$(JJ) $(JJFLAGS) $<

{src\world\geometry}.java{$(BUILD_DIR)\world\geometry}.class:
	$(JJ) $(JJFLAGS) $<
	
$(BUILD_DIR)\world\ClockBehavior.class: $(BUILD_DIR)\world\geometry\Clock.class
$(BUILD_DIR)\world\geometry\Room.class: $(BUILD_DIR)\world\geometry\FloorCeiling.class $(BUILD_DIR)\world\geometry\Walls.class


# create a distribution of the VRDemo to post on the VR website
#
dist:
	svn export ..\VRDemo ..\vrdemo_dist
	cp -R .settings ..\vrdemo_dist
	izarcc -a -r -P ..\vrdemo.zip ..\vrdemo_dist\*.*
	rmdir /S /Q ..\vrdemo_dist
	
	
clean:
	rm $(OBJECTS)